//
//  CollectViewController.m
//  HealthA段
//
//  Created by MrJXT on 15/6/11.
//  Copyright (c) 2015年 www.lanou3g.com 蓝鸥科技. All rights reserved.
//

#import "CollectViewController.h"
#import "dataBaseHandle.h"
#import "FoudCollectView.h"
#import "KnowCollectView.h"
#import "OperationCollectView.h"
#import "InspectCollectView.h"
#define WIDTH self.view.frame.size.width
#define HEIGHT self.view.frame.size.height
@interface CollectViewController ()<UITableViewDataSource,UITableViewDelegate>
@property(nonatomic,retain)UITableView *CollectView;
@property(nonatomic,retain)NSMutableArray *CollectArr;
@end

@implementation CollectViewController
- (void)dealloc
{
    [_CollectArr release];
    [_CollectView release];
    [super dealloc];
}
-(instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        self.CollectArr = [NSMutableArray array];
    }

    return self;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"123.jpeg"]];
    [self CreatView];
    // Do any additional setup after loading the view.
}
//创建视图
-(void)CreatView
{
    self.CollectView = [[UITableView alloc]initWithFrame:CGRectMake(0,0,WIDTH , HEIGHT) style:UITableViewStylePlain];
    [self.view addSubview:self.CollectView];
    self.CollectView.delegate = self;
    self.CollectView.dataSource = self;
    self.CollectView.backgroundColor = [UIColor clearColor];
    self.CollectView.rowHeight = 100;
    self.CollectView.pagingEnabled = NO;
    self.CollectView.tableFooterView = [[UIView alloc]initWithFrame:CGRectZero];

    self.CollectView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"123.jpeg"]];
//    self.CollectView.separatorStyle = UITableViewCellSeparatorStyleNone;
    [_CollectView release];
    
    self.title = @"我的收藏";
}
#pragma mark 实现协议方法
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 4;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *reuse = @"reuse";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:reuse];
    if (cell == nil) {
        cell = [[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:reuse]autorelease];
        cell.backgroundColor = [UIColor clearColor];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        cell.textLabel.textColor = [UIColor whiteColor];
    }
    if (indexPath.row == 0) {
        cell.textLabel.text = @"健康知识";
        return cell;
     } if(indexPath.row == 1){
        cell.textLabel.text = @"健康食谱";
        return cell;
    } if (indexPath.row == 2){
        cell.textLabel.text = @"手术项目";
        return cell;
    }else{
        cell.textLabel.text = @"检查项目";
    }
        return cell;
}
//跳转到具体收藏界面
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.row == 0) {
        KnowCollectView *kvc = [[KnowCollectView alloc]init];
        [self.navigationController pushViewController:kvc animated:YES];
        [kvc release];
    }else if (indexPath.row == 1){
        FoudCollectView *fvc = [[FoudCollectView alloc]init];
        [self.navigationController pushViewController:fvc animated:YES];
        [fvc release];
    }else if (indexPath.row == 2){
        OperationCollectView *ovc = [[OperationCollectView alloc]init];
        [self.navigationController pushViewController:ovc animated:YES];
        [ovc release];
    }else if (indexPath.row == 3){
        InspectCollectView *ivc = [[InspectCollectView alloc]init];
        [self.navigationController pushViewController:ivc animated:YES];
        [ivc release];
    }
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
